<!DOCTYPE html>
<html lang="en">
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>首页</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/resource/common/layui/css/layui.css">
    <link rel="stylesheet" href="/resource/js/front/index.css">
</head>
<style>
    #house-usershop-table + div td .layui-table-cell {
        height: 137px;
        padding-top: 19px;
    }

    #house-usershop-table + div td .layui-table-cell p {
        font-size: 15px;
    }

    .layui-form-label {
        text-align: left;
    }

    fieldset legend {
        color: #3e94ed;
    }
</style>
<body>
<div th:replace="front/head :: heads"></div>
<div style="width: 70%;margin-left: 15%;" class="layui-form" lay-filter="example">
    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
        <legend>收货地址</legend>
    </fieldset>
    <table class="layui-table" lay-skin="line" th:if="${address!=null}">
        <tbody>
        <tr>
            <td th:text="${address.cityPicker}"></td>
            <td th:text="${address.detailAddress}">汉族</td>
            <td th:text="${address.consignee}">1989-10-14</td>
            <td th:text="${address.phone}">人生似修行</td>
        </tr>
        </tbody>
    </table>
    <a href="/front/address.do" th:if="${address==null}" style="margin-left: 16px;color: #3e94ed;cursor: pointer">请先添加默认收货地址</a>
    <input hidden name="ids" th:value="${ids}">
    <input hidden name="nums" th:value="${nums}">
    <input hidden name="price" th:value="${zumPrice}">
    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
        <legend>配送方式</legend>
    </fieldset>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">配送方式:</label>
            <div class="layui-input-inline">
                <select name="mode">
                    <option value="物流">物流</option>
                    <option value="物流">自取</option>
                    <option value="快递">快递</option>
                </select>
            </div>
        </div>
    </div>
    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
        <legend>订单留言</legend>
    </fieldset>
    <div class="layui-form-item layui-form-text">
        <div class="layui-input-block" style="margin-left: 13px">
            <textarea placeholder="请输入内容" name="content" class="layui-textarea"></textarea>
        </div>
    </div>
    <div class="layui-form-item" style="margin-top: 40px;margin-left: 75%">
        <div class="layui-input-block">
            <button type="submit" class="layui-btn" lay-submit="" lay-filter="demo1" th:if="${address!=null}"
                    th:text="${'共计金额￥:'+zumPrice+' 提交订单'}" style="background-color: #3e94ed">
            </button>
        </div>
    </div>
</div>


<!-- layui.js -->
<script type="text/javascript" src="/resource/common/layui/layui.js"></script>
<script type="text/javascript" src="/resource/js/front/house.js"></script>
<!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
<!--[if lt IE 9]>
<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script th:inline="javascript">
    layui.use(['element', 'layer', 'form'], function () {
        var element = layui.element,
            layer = layui.layer,
            form = layui.form,
            $ = layui.$;
        //监听提交
        form.on('submit(demo1)', function (data) {
            console.log(data.field)
            $.ajax({
                url: '/front/settleAccounts.do',
                type: 'post',
                data: data.field,
                dataType: 'json',
                async: false,
                success: function (result) {
                    if (result.status) {
                        layer.alert("成功!", {
                            time: 2000,
                            end: function () {
                                location.href = '/front/order.do'
                            }
                        })
                    } else {
                        layer.msg(result.msg)
                    }
                }
            });
        });
    });
</script>

</body>
</html>